#include "assert.h"
#include <cstdio>
#include <exception>

namespace wilson
{

void
report_assertion_failure(const char* expr, const char* file, long line, const char* msg) noexcept
{
    // Write a message to the standard error stream.
    ::std::fprintf(stderr,
        "========================================================================\n"
        "*** ASSERTION FAILURE ***\n"
        "========================================================================\n"
        "Expression: %s\n"
        "Location:   %s:%ld\n"
        "Message:    %s\n"
        "========================================================================\n",
        expr, file, line, msg);

    // Prefer `std::terminate()` to `std::abort()`.
    ::std::terminate();
}

}
